<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of file
 *
 * @author user
 */
class File {

    /**
     * Save File
     * 
     * @param   string  Temporary path
     * @param   string  Save destination, relatif to website root
     */
    public static function save($tmp_name, $dest) {
        $dest = ROOT . '/' . $dest;

        if (!move_uploaded_file($tmp_name, $dest)) {
            show_error("Cannot Save file from $tmp_name to $dest");
            return FALSE;
        }

        return TRUE;
    }

    /**
     * Delete File
     *
     * If $file_name is exist, delete it, else do nothing (ignore).
     * @param <type> $file_name 
     */
    public static function delete($file_name) {
        $filename = ROOT . '/' . $file_name;
        if (file_exists($filename)) {
            unlink($filename);
        }
    }

}

?>
